package com.enation.app.javashop.api.client;

import com.enation.app.javashop.model.member.dos.AskMessageDO;
import com.enation.app.javashop.service.member.AskMessageManager;
import com.enation.app.javashop.service.member.MemberAskManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author fk
 * @version v2.0
 * @Description: 会员咨询对外client
 * @date 2018/7/30 15:06
 * @since v7.0.0
 */
@RestController
@RequestMapping("/client/members/ask")
@Validated
@ApiIgnore
public class MemberAskClientController {

    @Autowired
    private MemberAskManager memberAskManager;

    @Autowired
    private AskMessageManager askMessageManager;

    @GetMapping("/count")
    public Integer getNoReplyCount(@RequestParam("seller_id") Long sellerId) {

        return memberAskManager.getNoReplyCount(sellerId);
    }

    @RequestMapping(value = "/send", method = RequestMethod.POST)
    public void sendMessage(@RequestBody AskMessageDO askMessageDO){

        this.askMessageManager.addAskMessage(askMessageDO);
    }

}
